package com.jxx.androidstudy.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.jxx.androidstudy.R;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {


    private Button btn_activity;
    private Button btn_widget;
    private Button btn_store;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        InitView();
    }

    private void InitView() {
        btn_activity = (Button)findViewById(R.id.btn_activity);
        btn_activity.setOnClickListener(this);

        btn_widget = (Button) findViewById(R.id.btn_widget);
        btn_widget.setOnClickListener(this);

        btn_store = findViewById(R.id.btn_db);
        btn_store.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        if(view.getId() == R.id.btn_activity){
            Toast.makeText(this,"Click Activity....",Toast.LENGTH_LONG).show();
            Intent  activityIntent = new Intent(this,SecActivity.class);
            startActivity(activityIntent);
        }else if(view.getId() == R.id.btn_widget){
            Intent  activityIntent = new Intent(this,WidgetActivity.class);
            startActivity(activityIntent);
        }else if(view.getId() == R.id.btn_db){
            Intent activityIntent = new Intent(this,dbActivity.class);
            startActivity(activityIntent);
        }
    }
}